<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>收款</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <link rel="stylesheet" href="https://cdn.91haoka.cn/vant.css"/>
    <script src="https://cdn.91haoka.cn/vue.min.js"></script>
    <script src="https://cdn.91haoka.cn/vantall.js"></script>
    <script src="https://cdn.91haoka.cn/axios.min.js"></script>
</head>
<body>
<div id="app">
	<div id="apply">
		<div style="width: 100%; height: 20rem;">
			{{value2}}
			{{value3}}
			{{jianpan}}
		</div>
		<div class="f2"><van-field v-model="value" id="myInput" placeholder="请输入付款钱数" /></div>
	</div>
</div>
<script>
    var h = document.documentElement.clientWidth / 7.5 + 'px';
    document.documentElement.style.fontSize = h;
    new Vue({
        el: '#app',
        data: function() {
            return {
                value:"",
                jianpan:"",
				value2:"",
				value3:""
            }
        },
        created() {

        },
		mounted(){
			var that = this
			var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
			that.value2 = clientHeight
			
			    window.onresize = function() {
			        var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight;
					that.value3 = nowClientHeight
					that.value2 = clientHeight - nowClientHeight
			        if (clientHeight - nowClientHeight > 60 ) {//因为ios有自带的底部高度
			            //键盘弹出的事件处理
			            document.getElementById("apply").classList.add("focusState");
						that.jianpan = '弹出键盘'
			        }
			        else {
			            //键盘收起的事件处理
			        	document.getElementById("apply").classList.remove("focusState");
						that.jianpan = '收起键盘'
			        } 
			    };
			// let u = navigator.userAgent;
			// if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { //判断安卓手机
			// 	//  拿到获取焦点的input
			// 	let input = document.getElementById('myInput')
			// 	input.addEventListener('focus', function () {
			// 		console.log(1)
			// 		setInterval(function () {
			// 			input.scrollIntoView(true);
			// 		}, 100)
			// 	})
			// }
		},
        methods:{
            //获取url的code用
            getUrlParam:function(name) {   
                var query = window.location.search.substring(1);
                var vars = query.split("&");
                for (var i=0;i<vars.length;i++) {
                        var pair = vars[i].split("=");
                        if(pair[0] == name){return pair[1];}
                }
                return(false);
            },
            
        }
    })
</script>
<style type="text/css">
    *{ margin: 0; padding: 0; box-sizing: border-box;}
    a{ text-decoration: none;}
    html,body,#app{ font-size: 14px; background: #EAEAEA;}
    #app{ padding-top: 2rem; background: url("bb.png");}
   .focusState {position: absolute;}
</style>
</body>
</html>
